package com.br.gapps.crm.repository;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import com.br.gapps.crm.entity.AppUser;

public class AppUserRepository extends Repository {

	public AppUserRepository() {
	}
	public AppUserRepository(EntityManager manager) { 
		this.setManager(manager);
	}
	@SuppressWarnings("unchecked")
	public List<AppUser> findAll() {
		Query query = this.getManager().createQuery("SELECT e FROM AppUser e");
		return query.getResultList();
	}
	
	@SuppressWarnings("unchecked")
	public List<AppUser> findForIdlogin(String idlogin) {
		Query query = this.getManager().createQuery("SELECT e FROM AppUser e WHERE e.idlogin = ?1");
		query.setParameter(1, idlogin);
		return query.getResultList();
	}

}
